#ifndef MAINPAGE_H
#define MAINPAGE_H

#include <QWidget>
#include "Myself.h"
#include "Resignature.h"
#include "Vacation.h"
#include "Face.h"
#include "Mail.h"
#include "Situation.h"
#include <QTcpSocket>  // 添加用于 TCP 连接

namespace Ui {
class Mainpage;
}

class Client;  // 前向声明

class Mainpage : public QWidget
{
    Q_OBJECT

public:
    explicit Mainpage(const QString &employeeId, Client *client, QWidget *parent = nullptr);
    ~Mainpage();

protected:
    // 用于拖动窗口的事件处理函数
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;

    void paintEvent(QPaintEvent *event) override;

private slots:
    void on_returnButton_clicked();

    void on_num_clicked();

    void on_resignature_clicked();

    void on_vacation_clicked();

    void on_face_clicked();

    void on_mail_clicked();

    void on_situation_clicked();

private:
    Ui::Mainpage *ui;
    Client *clientWindow;
    QString employeeId;  // 存储工号
    QTcpSocket *tcpSocket;  // TCP Socket 用于与服务器通信

    // 用于记录拖动时鼠标位置的成员变量
    QPoint m_dragPosition;

    // 添加用于判断是否点击标题栏的成员变量
    bool m_isTitleBarClicked = false;
};

#endif // MAINPAGE_H
